/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/memory
// Copyright( c) 2014.  All Rights Reserved
//
// File:		AEMemoryAllocator.cpp
// Author:		Gianluca Belardelli
// Date:		27/05/2014
//
/////////////////////////////////////////////////////////////////////////
#include <AECore.h>

void *AEMemoryAllocator::BufAlloc( AEINT32 &nReqNumBytesInOut )
{
	return BlockAlloc( nReqNumBytesInOut );
}

void AEMemoryAllocator::BufFree( void *lpPtr, AEINT32 nNumBytes )
{
	BlockFree( lpPtr, nNumBytes );
}

void *AEMemoryAllocator::BufRealloc( void *lpOld, AEINT32 nOldNumBytes, AEINT32 &nReqNumBytesInOut )
{
	void *lpNewPtr = BlockAlloc( nOldNumBytes+nReqNumBytesInOut );
	memcpy( lpNewPtr, lpOld, nOldNumBytes );

	BlockFree( lpOld, nOldNumBytes );
	return lpNewPtr;
}

